﻿@section Styles{

}


<div class="portlet box blue-hoki">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-archive"></i>Alunos
        </div>
        <div class="tools">
        </div>
    </div>
    <div class="portlet-body">
        <table class="table table-striped table-bordered table-hover" id="Lista"></table>
        <div class="row">
            <div class="col-md-5 col-sm-12">
                <div id="Lista_info">
                </div>
            </div>
            <div class="col-md-7 col-sm-12">
                <div id="Lista_paginate">
                </div>
            </div>
        </div>
    </div>
</div>




@section Scripts{
    <script type="text/javascript">
        $(document).ready(function () {
            var language;
            $.ajax({
                dataType: "json",
                url: "@Url.Content("~/Base/GetLanguage")",
                success: function (dados) {
                    language = dados;
                }
            });

            var table = $('#Lista');

            /* Table tools samples: https://www.datatables.net/release-datatables/extras/TableTools/ */

            /* Set tabletools buttons and button container */

            $.extend(true, $.fn.DataTable.TableTools.classes, {
                "container": "btn-group tabletools-dropdown-on-portlet",
                "buttons": {
                    "normal": "btn btn-sm default",
                    "disabled": "btn btn-sm default disabled"
                },
                "collection": {
                    "container": "DTTT_dropdown dropdown-menu tabletools-dropdown-menu"
                }
            });

            var oTable = table.dataTable({

                // Internationalisation. For more info refer to http://datatables.net/manual/i18n
                "language": {
                    "sEmptyTable": "Nenhum registro encontrado",
                    "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
                    "sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
                    "sInfoFiltered": "(Filtrados de _MAX_ registros)",
                    "sInfoPostFix": "",
                    "sInfoThousands": ".",
                    "sLengthMenu": "_MENU_ resultados por página",
                    "sLoadingRecords": "Carregando...",
                    "sProcessing": "Processando...",
                    "sZeroRecords": "Nenhum registro encontrado",
                    "sSearch": "Pesquisar",
                    "oPaginate": {
                        "sNext": "Próximo",
                        "sPrevious": "Anterior",
                        "sFirst": "Primeiro",
                        "sLast": "Último"
                    },
                    "oAria": {
                        "sSortAscending": ": Ordenar colunas de forma ascendente",
                        "sSortDescending": ": Ordenar colunas de forma descendente"
                    }
                },
                "bProcessing": true,
                "bServerSide": true,
                "bAutoWidth": false,
                "sAjaxSource": '@Url.Content("~/Sistema/Responsavel/List")',
                "aoColumns": [
                    {
                        "sTitle": "Código",
                        "mDataProp": "CodResp",
                        "bSortable": false
                    },
                    {
                        "sTitle": "Nome",
                        "mDataProp": "Nome",
                        "bSortable": true
                    },
                    {
                        "sTitle": "Endereço",
                        "mDataProp": "Endereco",
                        "bSortable": false
                    },
                    {
                        "sTitle": "Cidade",
                        "mDataProp": "Cidade",
                        "bSortable": false
                    },
                    {
                        "sTitle": "Fone",
                        "mDataProp": "Fone",
                        "bSortable": false
                    },
                    {
                        "sTitle": "",
                        "mDataProp": "",
                        "sWidth": "110px",
                        "bSortable": false,
                        "mRender": function (innerData, sSpecific, oData) {
                            var render = '<div class="wrap-link-table"><a title="Editar" class="fa fa-pencil link-edit-table" href="' + oData.EditUrl + '"></a>';
                            render += '&nbsp;';
                            render += '<a title="Excluir" class="fa fa-times link-delete-table" href="' + oData.DeleteUrl + '"></a></div>';
                            return render;
                        }
                    }

                ],
                "order": [
                    [0, 'asc']
                ],

                "lengthMenu": [
                    [5, 15, 20, -1],
                    [5, 15, 20, "All"] // change per page values here
                ],
                // set the initial value
                "pageLength": 15,

                "dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable

                // Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
                // setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
                // So when dropdowns used the scrollable div should be removed.
                //"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",

                "tableTools": {
                    "sSwfPath": "/Content/Tema/swf/copy_csv_xls_pdf.swf",
                    "aButtons": [{
                        "sExtends": "pdf",
                        "sButtonText": "PDF"
                    }, {
                        "sExtends": "csv",
                        "sButtonText": "CSV"
                    }, {
                        "sExtends": "xls",
                        "sButtonText": "Excel"
                    }, {
                        "sExtends": "print",
                        "sButtonText": "Print",
                        "sInfo": 'Please press "CTR+P" to print or "ESC" to quit',
                        "sMessage": "Generated by DataTables"
                    }]
                }
            });

    });
    </script>
}
